<?php

session_start();
require_once('../classes/log.php');
require_once('../classes/database.php');

/********Actualisation de la session...**********/

include('../includes/fonctions.php');
$idconnect=Database::getInstance();
actualiser_session($idconnect);

/********Fin actualisation de session...**********/

if(isset($_SESSION['membre_id'])){
    header('Location: '.ROOTPATH.'/site.php');
    exit();
}

$titre = 'Inscription 1/2';
/**********Fin entête et titre***********/
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <link rel="stylesheet" href="<?php echo ROOTPATH;?>/style.css" />
		<!--[if lt IE 9]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <!--[if lte IE 7]>
        <link rel="stylesheet" href="style_ie.css" />
        <![endif]-->
        <title>Base de données Microcèbes</title>
    </head>

    <body>
		<header>
			<div id="titre_principal">
				<img src="<?php echo ROOTPATH;?>/logo.png" alt="Logo MMDN" id="logo" width="11%"/>
				<h1 id="titre"><?php echo TITRESITE;?></h1>
			</div>
		</header>
		<section id="bandeau">
			<section id="menu">
			<nav>
				<ul>
					<li><a href="<?php echo ROOTPATH;?>/site.php">Accueil</a></li>
					<li><a href="http://www.mmdn.univ-montp2.fr/" target="_blank">MMDN</a></li>
					<li><a href="#">Contact</a></li>
				</ul>
			</nav>
			</section>
			<section id="main">
				<h1><?php echo $titre; ?></h1>
				<?php
            if(isset($_SESSION['erreurs']) && $_SESSION['erreurs'] > 0)
            {
            ?>
            <div class="border-red">
            <h1>Note :</h1>
            <p>
            Lors de votre dernière tentative d'inscription, des erreurs sont survenues, en voici la liste :<br/>
            <?php
                echo $_SESSION['nb_erreurs'];
                echo $_SESSION['pseudo_info'];
                echo $_SESSION['mdp_info'];
                echo $_SESSION['mdp_verif_info'];
                echo $_SESSION['mail_info'];
                echo $_SESSION['mail_verif_info'];
                echo $_SESSION['nom_info'];
                echo $_SESSION['prenom_info'];
             
            ?><br/>
            Nous vous avons pré-rempli les champs qui étaient corrects.<br/>
            </p>
            </div>
            <?php
            }
            ?>
				<form method="post" action="trait_inscription.php">
					<p>
					<label class="label">Nom d'utilisateur:</label><input class="box" type="text" width="10" name="pseudo" value="<?php if(isset($_SESSION['pseudo_info']) && $_SESSION['pseudo_info'] == '') echo htmlspecialchars($_SESSION['form_pseudo'], ENT_QUOTES) ;?>"> <em>(compris entre 3 et 20 caract�res)</em><br/>
					<label class="label">Mot de passe:</label><input class="box" type="password" width="10" name="mdp" value="<?php if(isset($_SESSION['mdp_info']) && $_SESSION['mdp_info'] == '') echo htmlspecialchars($_SESSION['form_mdp'], ENT_QUOTES) ; ?>"> <em>(compris entre 6 et 10 caractères alphanumerique)</em><br/>
					<label class="label">Mot de passe (v�rification):</label><input class="box" type="password" width="10" name="mdp_verif" value="<?php if(isset($_SESSION['mdp_verif_info']) && $_SESSION['mdp_verif_info'] == '') echo htmlspecialchars($_SESSION['form_mdp_verif'], ENT_QUOTES) ; ?>"><br/>
					<label class="label">Email:</label><input class="box" type="text" width="20" name="mail" value="<?php if(isset($_SESSION['mail_info']) && $_SESSION['mail_info'] == '') echo htmlspecialchars($_SESSION['form_mail'], ENT_QUOTES) ; ?>"><br/>
					<label class="label">Email (v�rification):</label><input class="box" type="text" width="20" name="mail_verif" value="<?php if(isset($_SESSION['mail_verif_info']) && $_SESSION['mail_verif_info'] == '') echo htmlspecialchars($_SESSION['form_mail_verif'], ENT_QUOTES) ; ?>"><br/>
					<label class="label">Nom:</label><input class="box" type="text" width="10" name="nom" value="<?php if(isset($_SESSION['nom_info']) && $_SESSION['nom_info'] == '') echo htmlspecialchars($_SESSION['form_nom'], ENT_QUOTES) ; ?>"><em>(compris entre 3 et 20 caractères)</em><br/>
					<label class="label">Prénom:</label><input class="box" type="text" width="10" name="prenom" value="<?php if(isset($_SESSION['prenom_info']) && $_SESSION['prenom_info'] == '') echo htmlspecialchars($_SESSION['form_prenom'], ENT_QUOTES) ; ?>"><em>(compris entre 3 et 20 caractères)</em><br/>
					<label class="label">Message:</label>
					<textarea class="box" name="msg" rows="8" cols="40"></textarea><br/>

					<input type="submit" class="bouton2" value="Valider l'inscription">
					</p>
				</form>
			</section>
		</section>
	</body>
</html>
